cost<-1;
for(i in 1:7){
	print(i);
	control=Weka_control("cost-matrix"=matrix(c(0,cost,1,0),ncol=2), W="weka.classifiers.lazy.IBk");
	classifier<-CostSensitiveClassifier(class~.,data=trainData, control=control);
	results<-evaluate_Weka_classifier(classifier, numFolds=10)
	
	confMx<-results$confusionMatrix;
	IBk<-c(cost, ((confMx[1,1]+confMx[2,2])/sum(confMx)),
		confMx["benign","malignant"]/sum(confMx["benign",]),
		confMx["malignant","benign"]/sum(confMx["malignant",]),
		confMx["malignant","malignant"]/sum(confMx["malignant",]),
		confMx["benign","benign"]/sum(confMx["benign",]))

	summary<-cbind(summary,IBk);
	if(IBk[2]<=0.6){
		break;
	}
	cost=cost*4;
}
print(summary);

cost<-1;
for(i in 1:7){
	print(i);
	control=Weka_control("cost-matrix"=matrix(c(0,cost,1,0),ncol=2), W="weka.classifiers.bayes.NaiveBayes");
	classifier<-CostSensitiveClassifier(class~.,data=trainData, control=control);
	results<-evaluate_Weka_classifier(classifier, numFolds=10)
	
	confMx<-results$confusionMatrix;
	NaiveBayes<-c(cost, ((confMx[1,1]+confMx[2,2])/sum(confMx)),
		confMx["benign","malignant"]/sum(confMx["benign",]),
		confMx["malignant","benign"]/sum(confMx["malignant",]),
		confMx["malignant","malignant"]/sum(confMx["malignant",]),
		confMx["benign","benign"]/sum(confMx["benign",]))

	summary<-cbind(summary,NaiveBayes);
	if(NaiveBayes[2]<=0.6){
		break;
	}

	cost=cost*4;
}
print(summary);
